package wish.regularExpression;

import java.util.ArrayList;
import java.util.List;

public class MultipleElements extends RegularExpressionElement {

	private RegularExpressionElement repeatedElement;

	private List<RegularExpressionElement> list = new ArrayList<RegularExpressionElement>();
	
	public MultipleElements(RegularExpressionElement repeatedElement){
	
		this.repeatedElement = repeatedElement;
		
		list.addAll(repeatedElement.getMachingElements());
		
		
	}

	@Override
	public boolean matches(RegularExpressionElement regExpele) {
		
		return repeatedElement.matches(regExpele);
		
	}

	@Override
	public List<RegularExpressionElement> getMachingElements() {
		
		return list;
		
	}
	
	@Override
	public String toString() {
		return repeatedElement.toString() + "*";
	}
	
	@Override
	public boolean isMultipleMatch() {
		return true;
	}

	@Override
	protected RegularExpressionElement expandWithMatchingRegularExpression(
			RegularExpressionElement regExp) {
		return this;
	}
	
}
